<template>
  <div
    style="height: 523px; overflow: hidden; background: white; border:1px solid white ; border-radius: 8px; margin-top: 10px;">
    <div style="background-color: #E9EEF3; height: 95px; margin: 10px; padding: 4px; border-radius: 7px;">
      <el-row style="margin-top: 14px;">
        <el-col :span="10" style="font-size: 14px;">
          产品一级分类&nbsp;
          <el-select v-model="sa" size="mini">
            <el-option value="dasd">请选择</el-option>
          </el-select>
        </el-col>
        <el-col :span="10" style="font-size: 14px;">
          产品二级分类&nbsp;
          <el-select v-model="sa" size="mini">
            <el-option value="dasd">请选择</el-option>
          </el-select>
        </el-col>
      </el-row>
      <el-row style="margin-top: 14px;">
        <el-col :span="10" style="font-size: 14px;">
          产品三级分类&nbsp;
          <el-select v-model="sa" size="mini">
            <el-option value="dasd">请选择</el-option>
          </el-select>
        </el-col>
      </el-row>
    </div>
    <div style="background-color: #E9EEF3; height: 385px; margin: 10px; padding: 4px; border-radius: 7px;">
      <template>
        <el-table :data="tableData" style="width: 100% " size="mini">
          <el-table-column prop="cpbh" label="产品编号" width="320">
          </el-table-column>
          <el-table-column prop="cpmc" label="产品名称" width="100">
          </el-table-column>
          <el-table-column prop="cpleixing" label="用途类型" width="100">
          </el-table-column>
          <el-table-column prop="cpjibie" label="档次级别" width="100">
          </el-table-column>
          <el-table-column prop="cpIjfl" label="I级分类" width="100">
          </el-table-column>
          <el-table-column prop="cpIIjfl" label="II级分类" width="100">
          </el-table-column>
          <el-table-column prop="cpIIIjfl" label="III级分类" width="100">
          </el-table-column>
          <el-table-column label="制定" width="100">
            <template slot-scope="scope">
              <el-button size="mini" @click.native.prevent="ddd(scope.row.cpbh)" round>制定</el-button>
            </template>
          </el-table-column>
        </el-table>



      </template>

      <div class="block" style="margin-top: 10px;">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum"
          :page-sizes="[1, 4, 6, 7]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>

    </div>







    <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="库房编号" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="库房编号" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="责任人编号" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="安全庫存配置單" :visible.sync="dialogVisible" width="62%" height="300px" :before-close="handleClose">
      <div id="father">
        <el-container>
          <div style="width: 100%; padding: 25px;">
            <el-row>
              <el-col :span="15" style="text-align: left;">
                &nbsp;&nbsp;&nbsp;&nbsp;产品名称:{{cpmc}}
              </el-col>
              <el-col :span="9" style="text-align: right;">
                产品编号:{{cpbh}}
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="15" style="text-align: left;margin-top: 14px;">
                库存报警下限数: <input type="text" v-model="kcxx" id="inp" style=" margin-top: 15px;" />
              </el-col>
              <el-col :span="9" style="text-align: right;margin-top: 14px;">
                库存报警上限数: <input type="text" v-model="kcbjsx" id="inp" style=" margin-top: 15px;" />
              </el-col>
            </el-row>
            <el-row>

              <el-col :span="15" style="text-align: left;">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                设计人:<input type="text" v-model="sjr" id="inp" style=" margin-top: 15px;" />
              </el-col>
            </el-row>
          </div>
        </el-container>
        <el-table ref="multipleTable" :data="tableDataa" border tooltip-effect="dark"
          style="width: 100%;margin-top: 15px;" @selection-change="handleSelectionChange" size="mini">
          <el-table-column prop="cpbh" label="序号" width="100">
          </el-table-column>
          <el-table-column prop="houseName" label="库存名称" width="130">

          </el-table-column>
          <el-table-column prop="proidClass" label="存储地址编号" width="120">
          </el-table-column>
          <el-table-column prop="pronameClass" label="存储地址名称" width="150">
          </el-table-column>
          <el-table-column prop="ccmiaoshu" label="存储单元简称" width="130">
            <input type="text" v-model="ccmiaoshu" id="inp1" />
          </el-table-column>
          <el-table-column prop="kczdcl" label="最大存储量" width="128">
            <input type="text" v-model="kczdcl" id="inp1" />
          </el-table-column>
          <el-table-column prop="cuncudanwei" label="存储单位" width="140">
            <input type="text" v-model="cuncudanwei" id="inp1" />
          </el-table-column>
        </el-table>
        <div id="sons">
          <el-row>
            <el-col :span="9">
              登记人:<input type="text" v-model="inp" id="inp" style=" margin-top: 10px;" />
            </el-col>
            <el-col :span="15" :offset="3">
              登记时间 <input type="text" v-model="djsj" id="inp" style=" margin-top: 10px;" />
            </el-col>
          </el-row>
          <el-row style=" margin-top: 20px;">
            <el-col :span="2" style="margin-left: 72px;">
              配置要求:
            </el-col>
            <el-col :span="16">
              <textarea v-model="pzyq" style="width: 100%; height: 170px;">
          </textarea>
            </el-col>
          </el-row>
        </div>
      </div>
      <span slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="qd">确 定</el-button>
      </span>
    </el-dialog>




  </div>
</template>

<script>
  export default {
    name: 'repset',
    data() {
      return {
        tableData: [],
        pageNum: 1,
        pageSize: 7,
        total: 0,
        dialogVisible: false,
        dialogTableVisible: false,
        dialogFormVisible: false,
        dialogVisiblel: false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        tableDataaaa: [],
        tableDataa: [{
          proSige_id: '',
          cpbh: '',
          cpmc: '',
          ccmiaoshu: '',
          cuncudanwei: '',
          proName: '',
          prooName: '',
          proooName: '',
          houseName: '',
          proidClass: '',
          pronameClass: '',
          djr: '',
          djsj: ''
        }],
        cpbhwl: '',
        proSige_id: '',
        inp: '',
        djsj: '2021/06/07',
        cpbh: '',
        cpmc: '',
        sh: '未审核',
        kcxx: '',
        kcbjsx: '',
        sjr: '',
        kczdcl: '',
        ccmiaoshu: '',
        kcdyjc: '',
        cuncudanwei: '',
        pzyq: '',
        proidClass: '',
        pronameClass: '',
        formLabelWidth: '120px'
      }
    },
    methods: {
      GetOnline(pageNum, pageSize) {
        var datas = new URLSearchParams();
        datas.append("pageNum", pageNum);
        datas.append("pageSize", pageSize);
        this.$http.post('rep/repadminfindByPager', datas).then(res => {
          console.log(res.data);
          this.pageNum = res.data.pageNum;
          this.pageSize = res.data.pageSize;
          this.total = res.data.total;
          this.tableData = res.data.rows;
        }).catch(err => {
          console.log(err);
        })
      },
      tableRowClassName({
        row,
        rowIndex
      }) {
        if (rowIndex === 1) {
          return 'warning-row';
        } else if (rowIndex === 3) {
          return 'success-row';
        }
        return '';
      },
      handleClose(done) {
        this.$confirm('确认关闭？')
          .then(_ => {
            done();
          })
          .catch(_ => {});
      },
      ddd: function(row) {
        this.dialogVisible = true;
        var demo = new URLSearchParams()
        demo.append("cpbh", row)
        this.$http.post("selcpbhReoadmin", demo)
          .then((res) => {
            this.tableDataa = res.data;
            this.cpmc = res.data[0].cpmc;
            this.cpbh = res.data[0].cpbh;
            this.cuncudanwei = res.data[0].cuncudanwei;
            this.ccmiaoshu = res.data[0].ccmiaoshu;
            this.proSige_id = res.data[0].proSige_id;
            this.proidClass = res.data[0].proidClass;
            this.pronameClass = res.data[0].pronameClass;

          })
          .catch((err) => { //请求失败
            console.log(err);
          });

      },

      qd: function() {

        var demo = new URLSearchParams()
        demo.append("proSige_id", this.cpbh);
        demo.append("reviewSign", this.sh);
        demo.append("down", this.kcxx);
        demo.append("up", this.kcbjsx);
        demo.append("maxup", this.kczdcl);
        demo.append("denjiPerson", this.sjr);
        demo.append("time", this.djsj);
        demo.append("yaoqiu", this.pzyq);
        demo.append("uint", this.ccmiaoshu);
        demo.append("cuint", this.cuncudanwei);
        demo.append("aderessid", this.proidClass);
        demo.append("aderess", this.pronameClass);
        this.$http.post("insRepadminkcdy", demo)
          .then((res) => {
            var demo=new URLSearchParams()
            demo.append("pid",this.cpbh)
            demo.append("fenpeiSign",'已分配')
            this.$http.post("updPro_information",demo)
            .then((res) => {
            this.dialogFormVisible = false;
            })
            .catch((err) => { //请求失败
              console.log(err);
            });
          })
          .catch((err) => { //请求失败
            console.log(err);
          });


      },
      handleSizeChange(val) {
        this.pageSize = val;
        this.GetOnline(this.pageNum, this.pageSize);
      },
      handleCurrentChange(val) {
        this.pageNum = val;
        this.GetOnline(this.pageNum, this.pageSize);
      }
    },
    mounted() {
      this.GetOnline(this.pageNum, this.pageSize);
    }
  }
</script>

<style scoped="scoped">
  * {
    padding: 0px;
    margin: 0px;
  }

  #inp {
    border-top: none;
    border-left: none;
    border-right: none;
  }

  #inp1 {
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  th {
    border-top-color: #000000;
  }

  .el-breadcrumb__inner {
    color: black;

  }

  .el-input__inner {

    height: 25px;

  }

  .el-input__prefix,
  .el-input__suffix {
    position: absolute;
    top: 7px;
    -webkit-transition: all .3s;
    height: 100%;
    color: #C0C4CC;
    text-align: center;
  }

  .el-table td {
    padding: 10px 0;
  }

  #father {
    height: 480px;
    overflow: hidden;
    background: white;
    border: 1px solid white;
    border-radius: 12px;

  }

  #sons {
    /* margin: 9px auto; */

    width: 100%;
    padding: 0px;
    background-color: white;
    margin-top: 15px;
    /* border: 3px solid whitesmoke; */
    /* border-radius: 16px; */

  }

  #son {

    padding: 15px;
    width: 100%;
    background-color: white;

  }
</style>
